/*
 * Vector_Class.c
 *
 * Created: 1/22/2013 2:22:26 PM
 *  Author: Alexander
 */ 

#include "Vector_Class.h"

/**************************************************************************
* Method:		Vector_Init
* FullName:		Vector_Init
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
**************************************************************************/
void Vector_Init(AxesVector_t* vector)
{
	vector->AXIS_X = 0;
	vector->AXIS_Y = 0;
	vector->AXIS_Z = 0;
	vector->count = 0;
}

/**************************************************************************
* Method:		New_Vector
* FullName:		New_Vector
* Access:		public 
* Returns:		AxesVector_t*
* Qualifier:	
* Description:	
**************************************************************************/
AxesVector_ptr New_Vector()
{
	AxesVector_t *temp = (AxesVector_t*)malloc(sizeof(AxesVector_t));
		
	Vector_Init(temp);	
	return temp;
}

/**************************************************************************
* Method:		Get_X
* FullName:		Get_X
* Access:		public
* Returns:		int16_t
* Qualifier:
* Parameter:	AxesVector_t * vector
**************************************************************************/
int16_t Get_X(AxesVector_t* vector)
{
	return vector->AXIS_X;
}


/**************************************************************************
* Method:		Get_Y
* FullName:		Get_Y
* Access:		public
* Returns:		int16_t
* Qualifier:
* Parameter:	AxesVector_t * vector
**************************************************************************/
int16_t Get_Y(AxesVector_t* vector)
{
	return vector->AXIS_Y;
}


/**************************************************************************
* Method:		Get_Z
* FullName:		Get_Z
* Access:		public 
* Returns:		int16_t
* Qualifier:	
* Parameter:	AxesVector_t * vector
**************************************************************************/
int16_t Get_Z(AxesVector_t* vector)
{
	return vector->AXIS_Z;
}



/**************************************************************************
* Method:		Get_Count
* FullName:		Get_Count
* Access:		public 
* Returns:		int16_t
* Qualifier:	
* Parameter:	AxesVector_t * vector
**************************************************************************/
int16_t Get_Count(AxesVector_t* vector)
{
	return vector->count;
}


/**************************************************************************
* Method:		Update_X
* FullName:		Update_X
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t newVal
**************************************************************************/
void Update_X(AxesVector_t* vector, int16_t newVal)
{
	vector->AXIS_X = newVal;
}


/**************************************************************************
* Method:		Update_Y
* FullName:		Update_Y
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t newVal
**************************************************************************/
void Update_Y(AxesVector_t* vector, int16_t newVal)
{
	vector->AXIS_Y = newVal;
}


/**************************************************************************
* Method:		Update_Z
* FullName:		Update_Z
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t newVal
**************************************************************************/
void Update_Z(AxesVector_t* vector, int16_t newVal)
{
	vector->AXIS_Z = newVal;
}


/**************************************************************************
* Method:		Increment_Count
* FullName:		Increment_Count
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
**************************************************************************/
void Increment_Count(AxesVector_t* vector)
{
	vector->count += 1;
}


/**************************************************************************
* Method:		Update_Values
* FullName:		Update_Values
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t x
* Parameter:	int16_t y
* Parameter:	int16_t z
**************************************************************************/
void Update_Values(AxesVector_t* vector, int16_t x, int16_t y, int16_t z)
{
	vector->AXIS_X = x;
	vector->AXIS_Y = y;
	vector->AXIS_Z = z;
	vector->count += 1;
}

/**************************************************************************
* Method:		Copy_Vector
* FullName:		Copy_Vector
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * dest
* Parameter:	AxesVector_t * source
**************************************************************************/
void Copy_Vector(AxesVector_t* dest, AxesVector_t* source)
{
	dest->AXIS_X = source->AXIS_X;
	dest->AXIS_Y = source->AXIS_Y;
	dest->AXIS_Z = source->AXIS_Z;
	dest->count = source->count;
}

/**************************************************************************
* Method:		Add_Vectors
* FullName:		Add_Vectors
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * dest
* Parameter:	AxesVector_t * vect_2
**************************************************************************/
void Add_Vectors(AxesVector_t* dest, AxesVector_t* vect_2)
{
	int16_t value_1;
	int16_t value_2;
	
	value_1 = dest->AXIS_X;
	value_2 = vect_2->AXIS_X;
	
	value_1 += value_2;
	
	Update_X(dest, value_1);
	
	value_1 = dest->AXIS_Y;
	value_2 = vect_2->AXIS_Y;
	
	value_1 += value_2;
	
	Update_Y(dest, value_1);
	
	value_1 = dest->AXIS_Z;
	value_2 = vect_2->AXIS_Z;
	
	value_1 += value_2;
	
	Update_Z(dest, value_1);
}

/**************************************************************************
* Method:		Scalar_Multiply
* FullName:		Scalar_Multiply
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t scalar
**************************************************************************/
void Scalar_Multiply(AxesVector_t* vector, int16_t scalar)
{
	vector->AXIS_X *= scalar;
	vector->AXIS_Y *= scalar;
	vector->AXIS_Z *= scalar;
}

/**************************************************************************
* Method:		Scalar_Divide
* FullName:		Scalar_Divide
* Access:		public 
* Returns:		void
* Qualifier:	
* Parameter:	AxesVector_t * vector
* Parameter:	int16_t scalar
**************************************************************************/
void Scalar_Divide(AxesVector_t* vector, int16_t scalar)
{
	vector->AXIS_X /= scalar;
	vector->AXIS_Y /= scalar;
	vector->AXIS_Z /= scalar;
}

